<!DOCTYPE html>
<html>
<head>
	<title></title>
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>
</head>


<body>
<!--提货地址弹窗-->
<ul class="add-ul" id="tihuo_box" style="display: block">
	<input class="url" type="hidden" value="{:url('Depot/is_dizhi')}">
	{if condition="$address"}
	{volist name="address" id="vo"}
	<li class="{$vo.id}">
		<p style="">收货人：<span>{$vo['name']}</span> <span style="float: right;">电话：{$vo['phone']}</span></p>
		<p>
			<span>收货地址：{$vo['address']}</span>
		</p>
	</li>
	{/volist}
	{else /}
	<!--没有记录时显示-->
	<div class="no_record" style="width: 200px;text-align: center;margin: 0 auto;margin-top: 100px;">
		<img src="__INDEX__/images/kong.png" style="width: 100px;" />
		<p style="text-align: center;color: #555;font-size: 14px;">暂无地址，请添加地址</p>
	</div>
	{/if}
	<a href="javascript:;" class="add">添加地址</a>
</ul>
<script>

	var w = $(document).width();
	if(w >= 500) {
		w = 600;
	} else if(w <= 480) {
		w = 375;
	}

	$('.add-ul li').on('click',function(){
		var url = $('.url').val();
		var id = $(this).attr('class');
		$.ajax({
	        type: 'POST',
	        url: url,
	        dataType: 'json',
	        data: {id:id},
	        success: function (data) {
                window.parent.location.reload();
				var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
	        }
		});
	});

	//添加地址
	$('.add').on('click', function() {
		parent.layer.open({
			type: 2,
			title: '添加地址',
			maxmin: true,
			shadeClose: true, //点击遮罩关闭层
			area: [w * 0.9 + "px", '450px'],
			style:"z-index:0;background:#fff;",
			content: ['/index/Depot/address'],
		});
	});
	
</script>
</body>
</html>
